package com.mlh.springboot.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 缪林辉
 * @date 2024/3/3 20:11
 * @DESCRIPTION
 */
//@WebServlet 用于标识要注入该 Servlet
//urlPatterns = {"/servlet01", "/servlet02"}: 是映射路径
//注入的原生的Servlet不会被spring-boot的拦截器拦截,
//因为他和dispatchServlet是同一级别的
//对于开发的原生的Servlet注入容器中,
//还需要使用@ServletComponentScan指定要扫描的原生Servlet所在的包或者子包
//@WebServlet(urlPatterns = {"/servlet01","/servlet02"})
public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req,
                         HttpServletResponse resp) throws IOException {
        resp.getWriter().write("there is myServlet");
    }
}
